﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Innvoice.BaseDeDatos.innvoicedbDataSetTableAdapters;
using System.Data;
using Innvoice.Logica.GestorObject;
using System.Windows;

namespace Innvoice.Logica.GestorDB
{
    public class PaisDB
    {
        public void addPaises(){}

        public List<Pais> obtenerPaises()
        {
            List<Pais> misPaises = new List<Pais>();
            paisTableAdapter tablaPaises = new paisTableAdapter();
            DataTable mitablaresult = new DataTable();

            try
            {
                mitablaresult = tablaPaises.GetData();
                foreach (DataRow items in mitablaresult.Rows)
                {
                    Pais dataPaises = new Pais();

                    dataPaises.Codigo_pais = Convert.ToInt16(items["codigopais"].ToString());
                    dataPaises.Descripcion = items["descripcion"].ToString();

                    misPaises.Add(dataPaises);
                }                
            }
            catch (Exception)
            {
                MessageBox.Show("PaisDB - ObetenerPaises", "Error", MessageBoxButton.OK);
            }
            return misPaises;
        }

        public void insertarPais(String auxPais) { }

        public bool deletePais(int auxPais) { return true; }

        public void modificarPais(int auxPais, string descripPais) { }

    }
}
